//package com.bootdo.blog.controller;
//
//import com.bootdo.blog.domain.ContentDO;
//import com.bootdo.blog.service.ContentService;
//import com.bootdo.common.config.Constant;
//import com.bootdo.common.utils.PageUtils;
//import com.bootdo.common.utils.Query;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//
///**
// *
// *
// * @author bootdo 1992lcg@163.com
// */
//@RequestMapping("/blog")
//@Controller
//@Api(description = "新闻api", position = 1)
//public class BlogController {
//	@Autowired
//    ContentService bContentService;
//	@GetMapping()
//	String blog() {
//		return "blog/index/main";
//	}
//	@ResponseBody
//	@GetMapping("/open/list")
//	@ApiOperation(value = "新闻列表")
//	public PageUtils opentList(@RequestParam Map<String, Object> params) {
//		params.put("type", Constant.TYPE_NEWS);
//		Query query = new Query(params);
//		List<ContentDO> bContentList = bContentService.list(query);
//		int total = bContentService.count(query);
//		PageUtils pageUtils = new PageUtils(bContentList, total);
//		return pageUtils;
//	}
//
//	@GetMapping("/news/list")
//	@ResponseBody
//	@ApiOperation(value = "新闻列表")
//	public List<ContentDO> newsList() {
//		List<ContentDO> bContentList = bContentService.news(Constant.TYPE_NEWS);
//		return bContentList;
//	}
//
//	@GetMapping("/open/post/{cid}")
//	@ApiOperation(value = "根据id获取单个新闻")
//	@ResponseBody
//	String post(@PathVariable("cid") Long cid, Model model) {
//		ContentDO bContentDO = bContentService.get(cid);
////		model.addAttribute("bContent", bContentDO);
////		model.addAttribute("gtmModified", DateUtils.format(bContentDO.getGtmModified()));
////		return "blog/index/post";
//		return bContentDO.getContent();
//	}
//
//	@ApiOperation(value = "根据类别获取新闻")
//	@GetMapping("/open/page/{categories}")
//	String about(@PathVariable("categories") String categories, Model model) {
//		Map<String, Object> map = new HashMap<>(16);
//		map.put("categories", categories);
//		map.put("type", Constant.TYPE_NEWS);
//		ContentDO bContentDO =null;
//		if(bContentService.list(map).size()>0){
//			 bContentDO = bContentService.list(map).get(0);
//		}
//		model.addAttribute("bContent", bContentDO);
//		return "blog/index/post";
//	}
//
//
//}
